import axios from "axios";

export default async function () {
    // 验证用户身份
    return axios({
        method: "get",
        url: "/api/users/auth",
        params: {
            "authorization": localStorage.getItem("Authorization")
        }
    })
        .then(response => {
            // result为1时通过身份验证
            return {
                result: response.data.result - 0 === 1,
                identity: response.data.identity,
            }
        })
        .catch(() => {
            return {
                result: false
            }
        })
}